package leetcode20211001;

import java.util.HashSet;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LUYAO
 * Date: 2021-10-01
 * Time: 21:26
 */
public class FindRepetition {
    public static void main(String[] args) {

    }
}

class Solution1{
    public int findRepeatNumber(int[] nums) {
        HashSet<Integer> set = new HashSet<>();
        for (int num : nums){
            if(set.contains(num)) {
                return num;
            }else {
                set.add(num);
            }

        }
        return -1;
    }
}
